www.gusucode.com > SIMULINK Sigma-Delta Toolbox 工具箱matlab源码程序 > SIMULINK Sigma-Delta Toolbox/Sigma-Delta_Toolbox/SNRestimation.m

    % simout is the modulator output to test, f is the input frequency used for
% the test
function snr= SNRestimation(simout, f)

fs = 48e3;
testsig = simout(30:fs);

N = length(testsig);
spec=fft(testsig.*ds_hann(N)')/(N/4);
snr = calculateSNR(spec(1:fs/2),f);